package com.itheima.zuoye1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Demo1 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student(1,"小亮",99));
        list.add(new Student(2,"小勇",85));
        list.add(new Student(3,"小响",90));
        list.add(new Student(4,"小强",78));

        Collections.sort(list, new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o2.getScore()-o1.getScore();
            }
        });
        list.remove(list.size()-1);
        list.forEach(System.out::println);
    }
}
